<?php
namespace app\common\service\impl;
use app\common\model\Agency;
use app\common\service\AgencyService;
use app\common\utils\ResultVOUtil;
use think\facade\Log;
class AgencyServiceImpl implements AgencyService
{
    protected $agency;
    
    public function __construct(Agency $agency)
    {
        $this->agency = $agency;
    }
    
    public function list()
    {
        $agency_id = session('admin.agency_id');
        if(strpos($agency_id, '1')===false){
            $data = $this->agency->where('id','in',$agency_id)->select();
        }else{
            $data = $this->agency->all();
        }
        
        return ResultVOUtil::success($data);
    }
    
    public function queryAll()
    {
        try {
            $data = $this->agency->all();
        } catch (\Exception $e) {
            return false;
            Log::record('[ 查询加盟商 ]'.$e->getMessage(),'error');
        }
        
        return $data;
    }

}

